]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/remoteAccess: Port to click gestures
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 26 Sep 2025 03:01:01 +0000 (05:01 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 4 Nov 2025 17:55:32 +0000 (18:55 +0100)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3912>

js/ui/status/remoteAccess.js

index b7b70661efffda87c5088968822b51c95a9ed1cc..99d7f94838ad4ea5c2f045f5b469802541a8d5cf 100644 (file)
@@ -92,14 +92,12 @@ export const ScreenRecordingIndicator = GObject.registerClass({
         Main.screenshotUI.connect(
             'notify::screencast-in-progress',
             this._onScreencastInProgressChanged.bind(this));
-    }
-
-    vfunc_event(event) {
-        if (event.type() === Clutter.EventType.TOUCH_BEGIN ||
-            event.type() === Clutter.EventType.BUTTON_PRESS)
-            Main.screenshotUI.stopScreencast();
 
-        return Clutter.EVENT_PROPAGATE;
+        this._clickGesture = new Clutter.ClickGesture();
+        this._clickGesture.set_recognize_on_press(true);
+        this._clickGesture.connect(
+            'recognize', () => Main.screenshotUI.stopScreencast());
+        this.add_action(this._clickGesture);
     }
 
     _updateLabel() {
@@ -163,6 +161,11 @@ export const ScreenSharingIndicator = GObject.registerClass({
             (o, handle) => this._onNewHandle(handle));
 
         this._sync();
+
+        this._clickGesture = new Clutter.ClickGesture();
+        this._clickGesture.set_recognize_on_press(true);
+        this._clickGesture.connect('recognize', () => this._stopSharing());
+        this.add_action(this._clickGesture);
     }
 
     _onNewHandle(handle) {
@@ -184,14 +187,6 @@ export const ScreenSharingIndicator = GObject.registerClass({
         this._sync();
     }
 
-    vfunc_event(event) {
-        if (event.type() === Clutter.EventType.TOUCH_BEGIN ||
-            event.type() === Clutter.EventType.BUTTON_PRESS)
-            this._stopSharing();
-
-        return Clutter.EVENT_PROPAGATE;
-    }
-
     _stopSharing() {
         for (const handle of this._handles)
             handle.stop();